// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright (c) 2023 Yevhen Babiichuk (DustDFG)

#include <DotSort/TubeSetBuilder.hpp>

#include <cstdint>

#include <DotSort/GameRules/TubeSet.hpp>
#include <DotSort/GameRules/Tube.hpp>

TubeSetBuilder::TubeSetBuilder(uint8_t tubeSize, uint8_t tubeCount)
	: tubeSize(tubeSize)
	, tubeCount(tubeCount)
{}

void TubeSetBuilder::push(uint8_t tubeIndex, uint8_t dot)
{
	this->instance->tubes[tubeIndex].push(dot);
}

TubeSet* TubeSetBuilder::operator()()
{
	this->instance = new TubeSet(this->tubeSize, this->tubeCount);
	this->fillInstance();
	return this->instance;
}
